
//有三个线程，线程名称分别为：a，b，c。
//
//每个线程打印自己的名称。
public class Demo3 {
    public static void main(String[] args) {
        Thread a = new Thread(()->{
            System.out.print(Thread.currentThread().getName());
        },"A");

        Thread b = new Thread(()->{
            try {
                a.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.print(Thread.currentThread().getName());
        },"B");

        Thread c = new Thread(()->{
            try {
                b.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.print(Thread.currentThread().getName());
        },"C");
        a.start();
        b.start();
        c.start();
    }
}
